import Vue from 'vue'
import App from './App.vue'

// axios
import axios from 'axios'
// 指定根路径
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/';
Vue.prototype.$http = axios;

// 引入字体图标
import './assets/font-icon/iconfont.css'

// 引入全局样式表
import './assets/css/global.css'

// 引入按需element-ui
import './assets/js/element-ui'

// 引入nprogress(进度条)
import NProgress from 'nprogress';
import 'nprogress/nprogress.css'
axios.interceptors.request.use(config => {
    NProgress.start();
    // 设置请求头携带token
    config.headers.Authorization = window.sessionStorage.getItem('token');
    return config;
});
axios.interceptors.response.use(config => {
    NProgress.done();
    return config;
});

// 引入路由
import VueRouter from 'vue-router'
import router from './router/index.js'
Vue.use(VueRouter);


// 引入富文本编辑器(vue-quill-editor)
import VueQuillEditor from 'vue-quill-editor'
// 富文本编辑器相关样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)



Vue.config.productionTip = false

new Vue({
    render: h => h(App),
    router,
    beforeCreate() {
        Vue.prototype.$bus = this;  //安装全局事件总线
    }
}).$mount('#app')
